define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'taxi/wldrivers/index' + location.search,
                    add_url: 'taxi/wldrivers/add',
                    edit_url: 'taxi/wldrivers/edit',
                    del_url: 'taxi/wldrivers/del',
                    multi_url: 'taxi/wldrivers/multi',
                    import_url: 'taxi/wldrivers/import',
                    table: 'wldrivers',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        //
                        {field: 'id', title: __('Id'),visible: true },
                        //
                        {field: 'usertype', title: __('Usertype'),visible: true },
                        //
                        {field: 'fatherid', title: __('Fatherid'),visible: true },
                        //姓名
                        {field: 'persname', title: __('Persname'), operate:'like' ,visible: true },
                        //
                        {field: 'sex', title: __('Sex'), operate:'like' ,visible: true },
                        //年龄
                        {field: 'age', title: __('Age'), operate:'like' ,visible: true },
                        //身份证号
                        {field: 'persid', title: __('Persid'), operate:'like' ,visible: true },
                        //地址
                        {field: 'address', title: __('Address'), operate:'like' ,visible: true },
                        //民族
                        {field: 'minzu', title: __('Minzu'), operate:'like' ,visible: true },
                        //现居住地
                        {field: 'xianzhudi', title: __('Xianzhudi'), operate:'like' ,visible: true },
                        //家庭联系人
                        {field: 'jtlxr', title: __('Jtlxr'), operate:'like' ,visible: true },
                        //家庭联系人电话
                        {field: 'jtlxrphone', title: __('Jtlxrphone'), operate:'like' ,visible: true },
                        //在职年限
                        {field: 'zaizhinian', title: __('Zaizhinian'),visible: true },
                        //资格证
                        {field: 'zigezheng', title: __('Zigezheng'), operate:'like' ,visible: true },
                        //
                        {field: 'zigezheng_chulingdate', title: __('Zigezheng_chulingdate'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //发证单位
                        {field: 'fzdw', title: __('Fzdw'), operate:'like' ,visible: true },
                        //电话
                        {field: 'tel', title: __('Tel'), operate:'like' ,visible: true },
                        //区县
                        {field: 'city', title: __('City'), operate:'like' ,visible: true },
                        //公司
                        {field: 'compname', title: __('Compname'), operate:'like' ,visible: true },
                        //车号
                        {field: 'carnumber', title: __('Carnumber'), operate:'like' ,visible: true },
                        //车型
                        {field: 'cartype', title: __('Cartype'), operate:'like' ,visible: true },
                        //业务能力培训成绩
                        {field: 'yewucj', title: __('Yewucj'), operate:'like' ,visible: true },
                        //业务能力培训考核人
                        {field: 'yewucjkhr', title: __('Yewucjkhr'), operate:'like' ,visible: true },
                        //技术能力培训成绩
                        {field: 'jishucj', title: __('Jishucj'), operate:'like' ,visible: true },
                        //技术能力培训考核人
                        {field: 'jishucjkhr', title: __('Jishucjkhr'), operate:'like' ,visible: true },
                        //擅长车型
                        {field: 'shanchangcx', title: __('Shanchangcx'), operate:'like' ,visible: true },
                        //工龄工资
                        {field: 'gonglinggz', title: __('Gonglinggz'), operate:'BETWEEN',visible: true },
                        //技术补贴
                        {field: 'jishugz', title: __('Jishugz'), operate:'BETWEEN',visible: true },
                        //能力补贴
                        {field: 'nengligz', title: __('Nengligz'), operate:'BETWEEN',visible: true },
                        //基础工资
                        {field: 'jichugz', title: __('Jichugz'), operate:'BETWEEN',visible: true },
                        //年度考核成绩
                        {field: 'niankhcj', title: __('Niankhcj'), operate:'like' ,visible: true },
                        //车主
                        {field: 'carowner', title: __('Carowner'), operate:'like' ,visible: true },
                        //电话
                        {field: 'ownertel', title: __('Ownertel'), operate:'like' ,visible: true },
                        //营运状态
                        {field: 'ServiceState', title: __('Servicestate'), operate:'like' ,visible: true },
                        //
                        {field: 'ServiceCardState', title: __('Servicecardstate'), operate:'like' ,visible: true },
                        //年审日期
                        {field: 'nianshendate', title: __('Nianshendate'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'chulingzhengdate', title: __('Chulingzhengdate'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'note', title: __('Note'),visible: true },
                        //
                        {field: 'photo', title: __('Photo'), operate:'like' ,visible: true },
                        //
                        {field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'lock', title: __('Lock'),visible: true },
                        //
                        {field: 'new', title: __('New'),visible: true },
                        //身份证照片
                        {field: 'idimage', title: __('Idimage'), operate:'like' , formatter: Table.api.formatter.image},
                        //驾照照片
                        {field: 'dlimage', title: __('Dlimage'), operate:'like' , formatter: Table.api.formatter.image},
                        //
                        {field: 'examtype', title: __('Examtype'),visible: true },
                        //
                        {field: 'del', title: __('Del'),visible: true },
                        //
                        {field: 'ManageCardId', title: __('Managecardid'), operate:'like' ,visible: true },
                        //
                        {field: 'ManageCardTime', title: __('Managecardtime'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' , formatter: Table.api.formatter.datetime},
                        //
                        {field: 'BankId', title: __('Bankid'), operate:'like' ,visible: true },
                        //
                        {field: 'pxks_flag', title: __('Pxks_flag'), formatter: Table.api.formatter.flag},
                        //
                        {field: 'pxks_note', title: __('Pxks_note'), operate:'like' ,visible: true },
                        //
                        {field: 'pxks_lock_date', title: __('Pxks_lock_date'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'hmdjs_date', title: __('Hmdjs_date'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'zigezheng_yxq', title: __('Zigezheng_yxq'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'zigezheng_nianshen', title: __('Zigezheng_nianshen'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //
                        {field: 'dabh', title: __('Dabh'), operate:'like' ,visible: true },
                        //
                        {field: 'admin_id', title: __('Admin_id'),visible: true },
                        //
                        {field: 'user_id', title: __('User_id'),visible: true },
                        //状态:0=拒绝,1=提交,2=通过
                        {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
                        //
                        {field: 'auditone', title: __('Auditone'),visible: true },
                        //
                        {field: 'auditonetime', title: __('Auditonetime'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' , formatter: Table.api.formatter.datetime},
                        //
                        {field: 'auditonetxt', title: __('Auditonetxt'), operate:'like' ,visible: true },
                        //
                        {field: 'audittwo', title: __('Audittwo'),visible: true },
                        //
                        {field: 'audittowtime', title: __('Audittowtime'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' , formatter: Table.api.formatter.datetime},
                        //
                        {field: 'audittwotxt', title: __('Audittwotxt'), operate:'like' ,visible: true },
                        //终审状态:0=拒绝,1=提交,2=通过
                        {field: 'zsstatus', title: __('Zsstatus'), searchList: {"0":__('Zsstatus 0'),"1":__('Zsstatus 1'),"2":__('Zsstatus 2')}, formatter: Table.api.formatter.status},
                        //
                        {field: 'weixin', title: __('Weixin'), operate:'like' ,visible: true },
                        //
                        {field: 'alipay', title: __('Alipay'), operate:'like' ,visible: true },
                        //
                        {field: 'heimingdan', title: __('Heimingdan'),visible: true },
                        //
                        {field: 'heimingdaoqi', title: __('Heimingdaoqi'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //准驾车型
                        {field: 'zhunjia', title: __('Zhunjia'), operate:'like' ,visible: true },
                        //公司聘用日期
                        {field: 'pinyogdate', title: __('Pinyogdate'), operate:'RANGE', addclass:'datetimerange', datetimeFormat:'YYYY/MM/DD' ,visible: true },
                        //上岗证编号
                        {field: 'shanggangzheng', title: __('Shanggangzheng'), operate:'like' ,visible: true },
                        //技术等级
                        {field: 'dengji', title: __('Dengji'), operate:'like' ,visible: true },
                        //BCEL老币卡号
                        {field: 'bcelcard', title: __('Bcelcard'), operate:'like' ,visible: true },
                        //老币收款二维码
                        {field: 'laobiqr', title: __('Laobiqr'), operate:'like' ,visible: true },
                        //岗位职级
                        {field: 'gangzhiji', title: __('Gangzhiji'), operate:'like' ,visible: true },
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
